#include <bits/stdc++.h>

using namespace std;

// 找出所有的形如aabb的四位完全平方数 先筛选aabb型，再判断平方数
int main() {
    for (int i = 1000; i <= 9999; i++) {
        int a = i / 1000;
        int b = i % 1000 / 100;
        int c = i % 100 / 10;
        int d = i % 10;

        if (a == b && c == d) {
            // check i is square number or not?
            int r = (int)sqrt(i);
            if (r * r == i) {
                cout << i << endl;
            }
        }
    }

    return 0;
}
